package com.animation_study.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.animation_study.R;

/**
 * Created by css on 2017/12/26.
 */

public class TableAdapter extends RecyclerView.Adapter<TableAdapter.MyHolder> {


    @Override
    public MyHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new MyHolder(View.inflate(parent.getContext(), R.layout.layout_table, null));
    }

    @Override
    public void onBindViewHolder(MyHolder holder, int position) {
        holder.onBind(position);
    }

    @Override
    public int getItemCount() {
        return 50;
    }

    class MyHolder extends RecyclerView.ViewHolder {
        private TextView table_item;

        public MyHolder(View itemView) {
            super(itemView);
            table_item = itemView.findViewById(R.id.table_item);
        }

        private void onBind(int position) {
            table_item.setText("item" + position);
        }
    }
}
